home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / RIncludes / Fonts.r < prev    next >
Encoding:
Text File  |  1998-02-12  |  10.4 KB  |  315 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Fonts.r
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacOS 8
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18.  
  19. #ifndef __FONTS_R__
  20. #define __FONTS_R__
  21.  
  22. #ifndef __CONDITIONALMACROS_R__
  23. #include "ConditionalMacros.r"
  24. #endif
  25.  
  26. #ifndef __QUICKDRAW_R__
  27. #include "Quickdraw.r"
  28. #endif
  29.  
  30. /*----------------------------fctb • Font Color Lookup Table----------------------------*/
  31. type 'fctb' as 'clut';
  32.  
  33. /*----------------------------finf • Font Family Description----------------------------*/
  34. type 'finf' {
  35.         integer = $$CountOf(Fonts);                                /* # of fonts            */
  36.         array Fonts {
  37.             integer;                                            /* Font Number            */
  38.             unsigned hex integer    plain;                        /*         Font Style        */
  39.             integer;                                            /*         Font Size        */
  40.         };
  41. };
  42. /*----------------------------FOND • Font Family Description----------------------------*/
  43. /* Note: this FOND resource definition only works when the tables at the end of the
  44.          resource are in this order:    1 - Family Character-Width Table
  45.                                          2 - Style Mapping Table
  46.                                         3 - Kerning Tables
  47. */
  48. type 'FOND' {
  49.         /* Flags Word */
  50.         boolean        proportionalFont, fixedWidthFont;
  51.         boolean        useFractWidthTable, dontUseFractWidthTable;
  52.         boolean        computeFixedPointExtra, useIntegerExtra;
  53.         boolean        useFractEnable, ignoreFractEnable;
  54.         boolean        canAdjustCharSpacing, dontAdjustCharSpacing;
  55.         unsigned hex bitstring[9] = 0;                            /* Reserved                */
  56.         boolean        noCharWidthTable, hasCharWidthTable;
  57.         boolean        noImageHeightTable, hasImageHeightTable;
  58.  
  59.         integer;                                                /* Family ID number        */
  60.     First:
  61.         integer;                                                /* first char            */
  62.     Last:
  63.         integer;                                                /* last char            */
  64.         integer;                                                /* Ascent                */
  65.         integer;                                                /* Descent                */
  66.         integer;                                                /* Leading                */
  67.         integer;                                                /* Width Max            */
  68.     WidthOffset:
  69.         unsigned hex longint = WidthTable[1] >> 3;                /* Width table offset    */
  70.     KerningOffset:
  71.         unsigned hex longint = KerningTable[1] >> 3;            /* Kerning table offset    */
  72.     StyleMapOffset:
  73.         unsigned hex longint = StyleTable[1] >> 3;                /* Style map offset        */
  74.         integer;                                                /* reserved                */
  75.         integer;                                                /* ex wid bold            */
  76.         integer;                                                /* ex wid italic        */
  77.         integer;                                                /* ex wid underline        */
  78.         integer;                                                /* ex wid outline        */
  79.         integer;                                                /* ex wid shadow        */
  80.         integer;                                                /* ex wid condensed        */
  81.         integer;                                                /* ex wid extended        */
  82.         integer;                                                /* reserved                */
  83.         longint;                                                /* reserved for intl    */
  84.     Version:
  85.         integer;                                                /* version                */
  86.  
  87.         /* Font Association Table */
  88.         integer = $$CountOf(FontEntries)-1;                     /* # of font entries    */
  89.         wide array FontEntries {
  90.             integer;                                            /* Font size            */
  91.             unsigned hex integer    plain;                        /*         Font Style        */
  92.             integer;                                            /* Resource ID of FONT    */
  93.         };
  94.         /*  */
  95.         array [$$Word(Version) == 2] {
  96.     OffsetTableStart:
  97.             integer = $$CountOf(OffsetTable) - 1;
  98.             array OffsetTable {
  99.                 longint = (BBoxStart[1] - OffsetTableStart[1]) >> 3;
  100.             };
  101.             /* Font Bounding Box Table */
  102.     BBoxStart:
  103.             integer = $$CountOf(BBoxTable) - 1;
  104.             wide array BBoxTable {
  105.                 fill bit[9];                                    /* Reserved                */
  106.                 Boolean        noExtendedStyle, EXTENDEDstyle;        /* Extended style        */
  107.                 Boolean        noCondensedStyle, CONDENSEDstyle;    /* Condensed style        */
  108.                 Boolean        noShadowStyle, SHADOWstyle;            /* Shadow style            */
  109.                 Boolean        noOutlineStyle, OUTLINEstyle;        /* Outline style        */
  110.                 Boolean        noUnderline, UNDERLINEstyle;        /* Underline style        */
  111.                 Boolean        noItalicStyle, ITALICstyle;            /* Italic style            */
  112.                 Boolean        noBoldStyle, BOLDstyle;                /* Bold style            */
  113.                 Rect;
  114.             };
  115.         };
  116.  
  117.         /* Family Character-Width Table */
  118.         /* This outer array below handles the case when the width table offset (WidthOffset:)
  119.            is zero. */
  120.         array [$$Long(WidthOffset) != 0] {
  121.     WidthTable:
  122.             integer = $$CountOf(WidthTable) - 1;                /* # of width tables    */
  123.             wide array WidthTable {
  124.                 fill bit[9];                                    /* Reserved                */
  125.                 Boolean        noExtendedStyle, EXTENDEDstyle;        /* Extended style        */
  126.                 Boolean        noCondensedStyle, CONDENSEDstyle;    /* Condensed style        */
  127.                 Boolean        noShadowStyle, SHADOWstyle;            /* Shadow style            */
  128.                 Boolean        noOutlineStyle, OUTLINEstyle;        /* Outline style        */
  129.                 Boolean        noUnderline, UNDERLINEstyle;        /* Underline style        */
  130.                 Boolean        noItalicStyle, ITALICstyle;            /* Italic style            */
  131.                 Boolean        noBoldStyle, BOLDstyle;                /* Bold style            */
  132.  
  133.                 wide array [$$Word(Last) - $$Word(First) + 3] {
  134.                     unsigned hex integer;                        /* Width of character    */
  135.                 };
  136.             };
  137.         };
  138.  
  139.         /* Style Mapping Table */
  140.         /* This outer array below handles the case when the width table offset (WidthOffset:)
  141.            is zero. */
  142.         array [$$Long(StyleMapOffset) != 0] {
  143.     StyleTable:
  144.             unsigned hex integer;                                /* Font class            */
  145.     CharCodeOffset:
  146.             unsigned hex longint =                                /* Encoding table offset*/
  147.                 (CharCodeTable[1,1] - StyleTable[1]) / 8 * (CharCodeTable[1,1] != 0);
  148.             fill long;                                            /* Reserved                */
  149.             array [48] {
  150.                 byte;
  151.             };
  152.             /* Style Name Table */
  153.             integer = $$CountOf(StyleNames);                    /* Number of strings    */
  154.             pstring;                                            /* Full base font name    */
  155.             array StyleNames {
  156.                 pstring;                                        /* Style suffix names    */
  157.             };
  158.  
  159.             /* Character Set Encoding Table */
  160.             /* This outer array below handles the case when the character set encoding
  161.                offset is zero (CharCodeOffset:) */
  162.             array [$$Long(CharCodeOffset[1]) != 0] {
  163.     CharCodeTable:
  164.                 integer = $$CountOf(CharacterCodes);            /* Number of entries    */
  165.                 wide array CharacterCodes {
  166.                     char;                                        /* Character code        */
  167.                     pstring;                                    /* Char name string        */
  168.                 };
  169.             };
  170.         };
  171.  
  172.         /* Kerning Tables */
  173.         /* This outer array below handles the case when the kerning table offset
  174.            (KerningOffset:) is zero. */
  175.         array [$$Long(KerningOffset) != 0] {
  176.             /* Kerning Tables */
  177.     KerningTable:
  178.             integer = $$CountOf(KerningTables) - 1;                /* Number of tables        */
  179.             wide array KerningTables {
  180.                 fill bit[9];                                    /* Reserved                */
  181.                 Boolean        noExtendedStyle, EXTENDEDstyle;        /* Extended style        */
  182.                 Boolean        noCondensedStyle, CONDENSEDstyle;    /* Condensed style        */
  183.                 Boolean        noShadowStyle, SHADOWstyle;            /* Shadow style            */
  184.                 Boolean        noOutlineStyle, OUTLINEstyle;        /* Outline style        */
  185.                 Boolean        noUnderline, UNDERLINEstyle;        /* Underline style        */
  186.                 Boolean        noItalicStyle, ITALICstyle;            /* Italic style            */
  187.                 Boolean        noBoldStyle, BOLDstyle;                /* Bold style            */
  188.                 integer = $$CountOf(KerningTableEntry);            /* # of entries            */
  189.                 wide array KerningTableEntry {
  190.                     char;                                        /* first char of pair    */
  191.                     char;                                        /* second char of pair    */
  192.                     unsigned hex integer;                        /* kerning offset        */
  193.                 };
  194.             };
  195.         };
  196. };
  197. /*----------------------------FONT • Font Description-----------------------------------*/
  198. /* PROBLEMS: the offset to the offset/width table has been changed to a longint, with the
  199.              high word stored in the neg descent field (if its not -1).  Rez can't handle
  200.              this. */
  201. type 'FONT' {
  202.         /* Font Type Flags */
  203. FontType:
  204.         boolean = 1;                                            /* Reserved                */
  205.         boolean        doExpandFont, dontExpandFont;
  206.         boolean        proportionalFont, fixedWidthFont;
  207.         boolean = 1;                                            /* Reserved                */
  208.         unsigned bitstring[2] = 0;                                /* Reserved                */
  209.         boolean        blackFont, colorFont;
  210.         boolean        notSynthetic, isSynthetic;
  211.         boolean        nofctbRsrc, hasfctbRsrc;
  212.         unsigned bitstring[3] = 0;                                /* Reserved                */
  213.         unsigned bitstring[2]    oneBit, twoBit,                    /* Font depth            */
  214.                                 fourBit, eightBit;
  215.         boolean        noCharWidthTable, hasCharWidthTable;
  216.         boolean        noImageHeightTable, hasImageHeightTable;
  217.  
  218.     FirstChar:
  219.         integer;                                                /* first char            */
  220.     LastChar:
  221.         integer;                                                /* last char            */
  222.         integer;                                                /* width max            */
  223.         integer;                                                /* kern max                */
  224.         integer;                                                /* neg descent            */
  225.         integer;                                                /* font rect width        */
  226.     Height:
  227.         integer;                                                /* font rect height        */
  228.     Offset:
  229.         unsigned integer = ((WidthTable-Offset)/16);            /* offset to off/wid tab*/
  230.         integer;                                                /* ascent                */
  231.         integer;                                                /* descent                */
  232.         integer;                                                /* leading                */
  233.     RowWords:
  234.         integer;                                                /* row width (in words)    */
  235.  
  236.         /* Tables */
  237.         /* Bit image */
  238.         hex string [($$Word(RowWords) <<($$BitField(FontType, 12, 2)
  239.             & 3) + 1) * $$Word(Height)];
  240.  
  241.         /* Location Table */
  242.         array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  243.             integer;
  244.         };
  245.  
  246.         /* Offset/Width Table */
  247.     WidthTable:
  248.         array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  249.             integer;
  250.         };
  251.  
  252.         /* Optional Character Width Table */
  253.         Array [($$Word(FontType) & 0x0002) != 0] {
  254.             array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  255.                 integer;
  256.             };
  257.         };
  258.  
  259.         /* Optional Image Height Table */
  260.         Array [($$Word(FontType) & 0x0001) != 0] {
  261.             array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  262.                 integer;
  263.             };
  264.         };
  265. };
  266. /*----------------------------FWID • Font Width Table-----------------------------------*/
  267. type 'FWID' {
  268.         unsigned hex integer;                                    /* Font type            */
  269.         integer;                                                /* first char            */
  270.         integer;                                                /* last char            */
  271.         integer;                                                /* width max            */
  272.         integer;                                                /* kern max                */
  273.         integer;                                                /* neg descent            */
  274.         integer;                                                /* font rect width        */
  275.         integer;                                                /* font rect height        */
  276.         unsigned hex integer;                                    /* offset to off/wid tab*/
  277.         integer;                                                /* ascent                */
  278.         integer;                                                /* descent                */
  279.         integer;                                                /* leading                */
  280.         integer;                                                /* row width (in words)    */
  281.         wide array {                                            /* offset/width table    */
  282.             byte;                                                /* char offset            */
  283.             byte;                                                /* char width            */
  284.         };
  285. };
  286.  
  287. /*----------------------------NFNT • Font Description-----------------------------------*/
  288. type 'NFNT' as 'FONT';
  289.  
  290. /* FRSV and resf • reserved fonts */
  291.  
  292.     type 'FRSV' {
  293.         integer = $$CountOf(ReservedFontArray);
  294.         wide array ReservedFontArray {
  295.             unsigned bitstring[9]    Chicago = 0, Geneva = 3, Monaco = 4;    // font family
  296.             unsigned bitstring[7];                                            // font size
  297.         };
  298.     };
  299.  
  300.     type 'resf' {
  301.         integer = $$CountOf(FamilyArray);
  302.         array FamilyArray {
  303.             pstring;
  304.             align word;
  305.             integer = $$CountOf(FontRecord);
  306.             array FontRecord {
  307.                 integer;                        // point size
  308.                 integer plain;                    // style
  309.             };
  310.         };
  311.     };
  312.  
  313. #endif /* __FONTS_R__ */
  314.  
  315.